package com.nulldev.util.java.swing.extSwing.jtabbedpane;

import java.awt.Color;
import java.awt.Graphics2D;

import javax.swing.JComponent;
import javax.swing.Painter;

public class BackgroundPainter implements Painter<JComponent> {

	private Color color = null;

	public BackgroundPainter(final Color c) {
	    this.color = c;
	}
	
	public Color getColor() {
		return this.color;
	}
	
	public void setColor(final Color c) {
		this.color = c;
	}

	@Override
	public void paint(Graphics2D g, JComponent object, int width, int height) {
	    if (this.color != null) {
	        g.setColor(this.color);
	        g.fillRect(0, 0, width - 1, height - 1);
	    }
	}
}
